﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using System.Data;
using System.Data.SqlClient;

namespace BLL
{
    public class TINHTRANGHSBLL
    {
        DataService DB = new DataService();

        public TINHTRANGHS findByName(string name)
        {
            string sql = "select * from tinhtranghs where tentinhtranghs = '" + name + "'";

            TINHTRANGHS ttHs = new TINHTRANGHS();

            DataTable table = new DataTable();
            table = DB.ExecuteReader(sql);
            DataRow r = table.Rows[0];

            ttHs.matinhtranghs = (int)r[0];
            ttHs.tentinhtranghs = (string)r[1];

            return ttHs;
        }

        public int UnBlock()
        {
            string sql = "select * from tinhtranghs where tentinhtragnhs = 'UnBlock'";

            DataTable table = new DataTable();
            table = DB.ExecuteReader(sql);
            DataRow r = table.Rows[0];

            return (int)r[0];
        }

        public int Block()
        {
            string sql = "select * from tinhtranghs where tentinhtragnhs = 'Block'";

            DataTable table = new DataTable();
            table = DB.ExecuteReader(sql);
            DataRow r = table.Rows[0];

            return (int)r[0];
        }
    }
}
